/*
 * Copyright (C) 2019-2020 Alibaba Group Holding Limited
 */

#ifndef _MVOICE_IMPL_H_
#define _MVOICE_IMPL_H_

#ifdef __cplusplus
extern "C" {
#endif

#include "mvoice_alg.h"

typedef struct {
    char *name;
    alg_data_format_t data_format;
    int (*init)(void *priv, mvoice_event_cb cb);
    int (*deinit)(void *priv);
    int (*kws_proc)(void *priv, void *voice_data);          // for offline process
    int (*asr_proc)(void *priv, void *voice_data);          // for offline process
} mvoice_alg_t;

/**
 * @brief  register voice algorithm
 * @param  [in] alg          : algorithm module
 * @return 0 on success, < 0 on failed
 */
int mvoice_alg_register(mvoice_alg_t *alg);

/**
 * @brief  init voice algorithm, and register user callback
 * @param  [in] cb          : algorithm event callback
 * @param  [in] priv        : user private data
 * @return 0 on success, < 0 on failed
 */
int mvoice_alg_init(mvoice_event_cb cb, void *priv);

#define VAG_CB(evt, data, size) do { if (mvoice_alg_callback) mvoice_alg_callback(evt, data, size); } while(0)


#ifdef __cplusplus
}
#endif

#endif